package top.drose;

import java.util.Arrays;
import java.util.Scanner;

/// luogu 1540  使用手写循环队列
public class p8_2 {
    static final int N = 105;
    static class MyDequeue{
        private final int[] data=new int[N];
        int head,rear;

        boolean init(){
            head=rear=0;
            return true;
        }
        int size(){
            //循环队列的计算方法，因为rear可能比head还小
            return (rear-head+N)%N;
        }
        boolean empty(){
            if(this.size()==0){
                return true;
            }
            return false;
        }
        boolean push(int item){
            if((rear+1)%N==head){
                return false;//队列满了
            }
            data[rear]=item;
            rear=(rear+1)%N;
            return true;
        }
        //队列为空返回null
        Integer pop(){
            if(head==rear){
                return null;
            }
            int res=data[head];
            head=(head+1)%N;
            return res;
        }

    }
    public static void main(String[] args) {

        int[] Hash=new int[N];
        Arrays.fill(Hash,0);
        int cnt=0;
        MyDequeue Q=new MyDequeue();
        Q.init();
        int m,n;
        Scanner sc=new Scanner(System.in);
        m=sc.nextInt();n=sc.nextInt();
        while((n--)!=0){
            int en;en=sc.nextInt();
            if(Hash[en]==0){
                cnt++;
                Q.push(en);
                Hash[en]=1;
                while(Q.size()>m){//队列满了就不断弹出
                    int temp=Q.pop();
                    Hash[temp]=0;
                }
            }
        }
        System.out.printf("%d",cnt);
    }
}
